/**
 * @description  Barra（风险归因）
 */
import React, { PureComponent } from 'react';
import { connect } from 'dva';
import { Row, Col } from 'antd';
import { FirstHeaderC, PrimaryGhostC, SecondHeaderC } from '../../../../comps';
import DecomposeRisk from '../publicComponent/decomposeIncome'; // 风险分解
import ExcessTrend from '../publicComponent/excessTrend'; // 超额趋势
import FactorRiskTrend from './factorRiskTrend'; // 因子风险
import FactorRiskContribution from './factorRiskContribution'; // 因子收益贡献
import { exportFile } from '@/src/utils/commonFunc';

class Barra extends PureComponent {
  constructor() {
    super();
    this.state = {};
  }

  export = () => {
    const { args } = this.props;
    exportFile('thfx/barra/downloadRiskContributionDetail/', args);
  };

  render() {
    const { args, timeStamp } = this.props;
    return (
      <div style={{ marginTop: '20px' }}>
        <SecondHeaderC title='因子风险' />
        <div style={{ marginBottom: '20px' }}>
          <FactorRiskTrend args={args} timeStamp={timeStamp} />
        </div>
        <SecondHeaderC title='归因概览' />
        <div style={{ marginBottom: '20px' }}>
          <Row gutter={16}>
            <Col span={12}>
              <DecomposeRisk args={args} timeStamp={timeStamp} />
            </Col>
            <Col span={12}>
              <ExcessTrend args={args} timeStamp={timeStamp} />
            </Col>
          </Row>
        </div>
        <SecondHeaderC title='因子风险贡献' Right={<PrimaryGhostC title='导出' onClick={this.export} />} />
        <div style={{ marginBottom: '20px' }}>
          <FactorRiskContribution args={args} timeStamp={timeStamp} />
        </div>
      </div>
    );
  }
}
export default Barra;
